Optimal. Leaf size=293 \[ -\frac {x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )+b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b \left (A b^2-a (b B-a C)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right ) (b c-a d)^2}+\frac {A d^2-B c d+c^2 C}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {\left (b \left (c^2 d^2 (3 A-C)+A d^4-2 B c^3 d+c^4 C\right )-a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^2 (b c-a d)^2} \]
[Out]
________________________________________________________________________________________
Rubi [A] time = 0.81, antiderivative size = 293, normalized size of antiderivative = 1.00, number of steps used = 4, number of rules used = 3, integrand size = 45, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3649, 3651, 3530} \[ -\frac {x \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )+b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b \left (A b^2-a (b B-a C)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{f \left (a^2+b^2\right ) (b c-a d)^2}+\frac {A d^2-B c d+c^2 C}{f \left (c^2+d^2\right ) (b c-a d) (c+d \tan (e+f x))}-\frac {\left (b \left (c^2 d^2 (3 A-C)+A d^4-2 B c^3 d+c^4 C\right )-a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{f \left (c^2+d^2\right )^2 (b c-a d)^2} \]
Antiderivative was successfully verified.
[In]
[Out]
Rule 3530
Rule 3649
Rule 3651
Rubi steps
\begin {align*} \int \frac {A+B \tan (e+f x)+C \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))^2} \, dx &=\frac {c^2 C-B c d+A d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac {\int \frac {-a A c d+a d (c C-B d)+A b \left (c^2+d^2\right )+(b c-a d) (B c-(A-C) d) \tan (e+f x)+b \left (c^2 C-B c d+A d^2\right ) \tan ^2(e+f x)}{(a+b \tan (e+f x)) (c+d \tan (e+f x))} \, dx}{(b c-a d) \left (c^2+d^2\right )}\\ &=-\frac {\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )+b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {c^2 C-B c d+A d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}+\frac {\left (b \left (A b^2-a (b B-a C)\right )\right ) \int \frac {b-a \tan (e+f x)}{a+b \tan (e+f x)} \, dx}{\left (a^2+b^2\right ) (b c-a d)^2}-\frac {\left (b \left (c^4 C-2 B c^3 d+c^2 (3 A-C) d^2+A d^4\right )-a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \int \frac {d-c \tan (e+f x)}{c+d \tan (e+f x)} \, dx}{(b c-a d)^2 \left (c^2+d^2\right )^2}\\ &=-\frac {\left (a \left (c^2 C-2 B c d-C d^2-A \left (c^2-d^2\right )\right )+b \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) x}{\left (a^2+b^2\right ) \left (c^2+d^2\right )^2}+\frac {b \left (A b^2-a (b B-a C)\right ) \log (a \cos (e+f x)+b \sin (e+f x))}{\left (a^2+b^2\right ) (b c-a d)^2 f}-\frac {\left (b \left (c^4 C-2 B c^3 d+c^2 (3 A-C) d^2+A d^4\right )-a d^2 \left (2 c (A-C) d-B \left (c^2-d^2\right )\right )\right ) \log (c \cos (e+f x)+d \sin (e+f x))}{(b c-a d)^2 \left (c^2+d^2\right )^2 f}+\frac {c^2 C-B c d+A d^2}{(b c-a d) \left (c^2+d^2\right ) f (c+d \tan (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] time = 7.50, size = 592, normalized size = 2.02 \[ -\frac {\frac {b^2 \left (c^2+d^2\right ) \left (A b^2-a (b B-a C)\right ) \log (a+b \tan (e+f x))}{\left (a^2+b^2\right ) (b c-a d)}-\frac {b (b c-a d) \log \left (\sqrt {-b^2}-b \tan (e+f x)\right ) \left (-\frac {\sqrt {-b^2} \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )+b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{b}+2 a A c d-a B c^2+a B d^2-2 a c C d+A b c^2-A b d^2+2 b B c d-b c^2 C+b C d^2\right )}{2 \left (a^2+b^2\right ) \left (c^2+d^2\right )}-\frac {b (b c-a d) \log \left (\sqrt {-b^2}+b \tan (e+f x)\right ) \left (\frac {\sqrt {-b^2} \left (a \left (-A \left (c^2-d^2\right )-2 B c d+c^2 C-C d^2\right )+b \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right )}{b}+2 a A c d-a B c^2+a B d^2-2 a c C d+A b c^2-A b d^2+2 b B c d-b c^2 C+b C d^2\right )}{2 \left (a^2+b^2\right ) \left (c^2+d^2\right )}-\frac {b \left (b \left (c^2 d^2 (3 A-C)+A d^4-2 B c^3 d+c^4 C\right )-a d^2 \left (2 c d (A-C)-B \left (c^2-d^2\right )\right )\right ) \log (c+d \tan (e+f x))}{\left (c^2+d^2\right ) (b c-a d)}}{b f \left (c^2+d^2\right ) (a d-b c)}-\frac {A d^2-c (B d-c C)}{f \left (c^2+d^2\right ) (a d-b c) (c+d \tan (e+f x))} \]
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
fricas [B] time = 2.71, size = 1275, normalized size = 4.35 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
giac [B] time = 5.67, size = 846, normalized size = 2.89 \[ \frac {\frac {2 \, {\left (A a c^{2} - C a c^{2} + B b c^{2} + 2 \, B a c d - 2 \, A b c d + 2 \, C b c d - A a d^{2} + C a d^{2} - B b d^{2}\right )} {\left (f x + e\right )}}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} + \frac {{\left (B a c^{2} - A b c^{2} + C b c^{2} - 2 \, A a c d + 2 \, C a c d - 2 \, B b c d - B a d^{2} + A b d^{2} - C b d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{a^{2} c^{4} + b^{2} c^{4} + 2 \, a^{2} c^{2} d^{2} + 2 \, b^{2} c^{2} d^{2} + a^{2} d^{4} + b^{2} d^{4}} + \frac {2 \, {\left (C a^{2} b^{2} - B a b^{3} + A b^{4}\right )} \log \left ({\left | b \tan \left (f x + e\right ) + a \right |}\right )}{a^{2} b^{3} c^{2} + b^{5} c^{2} - 2 \, a^{3} b^{2} c d - 2 \, a b^{4} c d + a^{4} b d^{2} + a^{2} b^{3} d^{2}} - \frac {2 \, {\left (C b c^{4} d - 2 \, B b c^{3} d^{2} + B a c^{2} d^{3} + 3 \, A b c^{2} d^{3} - C b c^{2} d^{3} - 2 \, A a c d^{4} + 2 \, C a c d^{4} - B a d^{5} + A b d^{5}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{b^{2} c^{6} d - 2 \, a b c^{5} d^{2} + a^{2} c^{4} d^{3} + 2 \, b^{2} c^{4} d^{3} - 4 \, a b c^{3} d^{4} + 2 \, a^{2} c^{2} d^{5} + b^{2} c^{2} d^{5} - 2 \, a b c d^{6} + a^{2} d^{7}} + \frac {2 \, {\left (C b c^{4} d \tan \left (f x + e\right ) - 2 \, B b c^{3} d^{2} \tan \left (f x + e\right ) + B a c^{2} d^{3} \tan \left (f x + e\right ) + 3 \, A b c^{2} d^{3} \tan \left (f x + e\right ) - C b c^{2} d^{3} \tan \left (f x + e\right ) - 2 \, A a c d^{4} \tan \left (f x + e\right ) + 2 \, C a c d^{4} \tan \left (f x + e\right ) - B a d^{5} \tan \left (f x + e\right ) + A b d^{5} \tan \left (f x + e\right ) + 2 \, C b c^{5} - C a c^{4} d - 3 \, B b c^{4} d + 2 \, B a c^{3} d^{2} + 4 \, A b c^{3} d^{2} - 3 \, A a c^{2} d^{3} + C a c^{2} d^{3} - B b c^{2} d^{3} + 2 \, A b c d^{4} - A a d^{5}\right )}}{{\left (b^{2} c^{6} - 2 \, a b c^{5} d + a^{2} c^{4} d^{2} + 2 \, b^{2} c^{4} d^{2} - 4 \, a b c^{3} d^{3} + 2 \, a^{2} c^{2} d^{4} + b^{2} c^{2} d^{4} - 2 \, a b c d^{5} + a^{2} d^{6}\right )} {\left (d \tan \left (f x + e\right ) + c\right )}}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maple [B] time = 0.55, size = 1263, normalized size = 4.31 \[ \text {result too large to display} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
maxima [A] time = 0.50, size = 513, normalized size = 1.75 \[ \frac {\frac {2 \, {\left ({\left ({\left (A - C\right )} a + B b\right )} c^{2} + 2 \, {\left (B a - {\left (A - C\right )} b\right )} c d - {\left ({\left (A - C\right )} a + B b\right )} d^{2}\right )} {\left (f x + e\right )}}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}} + \frac {2 \, {\left (C a^{2} b - B a b^{2} + A b^{3}\right )} \log \left (b \tan \left (f x + e\right ) + a\right )}{{\left (a^{2} b^{2} + b^{4}\right )} c^{2} - 2 \, {\left (a^{3} b + a b^{3}\right )} c d + {\left (a^{4} + a^{2} b^{2}\right )} d^{2}} - \frac {2 \, {\left (C b c^{4} - 2 \, B b c^{3} d - 2 \, {\left (A - C\right )} a c d^{3} + {\left (B a + {\left (3 \, A - C\right )} b\right )} c^{2} d^{2} - {\left (B a - A b\right )} d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{b^{2} c^{6} - 2 \, a b c^{5} d - 4 \, a b c^{3} d^{3} - 2 \, a b c d^{5} + a^{2} d^{6} + {\left (a^{2} + 2 \, b^{2}\right )} c^{4} d^{2} + {\left (2 \, a^{2} + b^{2}\right )} c^{2} d^{4}} + \frac {{\left ({\left (B a - {\left (A - C\right )} b\right )} c^{2} - 2 \, {\left ({\left (A - C\right )} a + B b\right )} c d - {\left (B a - {\left (A - C\right )} b\right )} d^{2}\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{{\left (a^{2} + b^{2}\right )} c^{4} + 2 \, {\left (a^{2} + b^{2}\right )} c^{2} d^{2} + {\left (a^{2} + b^{2}\right )} d^{4}} + \frac {2 \, {\left (C c^{2} - B c d + A d^{2}\right )}}{b c^{4} - a c^{3} d + b c^{2} d^{2} - a c d^{3} + {\left (b c^{3} d - a c^{2} d^{2} + b c d^{3} - a d^{4}\right )} \tan \left (f x + e\right )}}{2 \, f} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
mupad [B] time = 85.86, size = 430, normalized size = 1.47 \[ \frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (B-A\,1{}\mathrm {i}+C\,1{}\mathrm {i}\right )}{2\,f\,\left (a\,c^2-a\,d^2-2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (A\,1{}\mathrm {i}+B-C\,1{}\mathrm {i}\right )}{2\,f\,\left (a\,d^2-a\,c^2+2\,b\,c\,d+b\,c^2\,1{}\mathrm {i}-b\,d^2\,1{}\mathrm {i}+a\,c\,d\,2{}\mathrm {i}\right )}+\frac {\ln \left (a+b\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (C\,a^2\,b-B\,a\,b^2+A\,b^3\right )}{f\,\left (a^4\,d^2-2\,a^3\,b\,c\,d+a^2\,b^2\,c^2+a^2\,b^2\,d^2-2\,a\,b^3\,c\,d+b^4\,c^2\right )}-\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (C\,b\,c^4-2\,B\,b\,c^3\,d+\left (3\,A\,b+B\,a-C\,b\right )\,c^2\,d^2+\left (2\,C\,a-2\,A\,a\right )\,c\,d^3+\left (A\,b-B\,a\right )\,d^4\right )}{f\,\left (a^2\,c^4\,d^2+2\,a^2\,c^2\,d^4+a^2\,d^6-2\,a\,b\,c^5\,d-4\,a\,b\,c^3\,d^3-2\,a\,b\,c\,d^5+b^2\,c^6+2\,b^2\,c^4\,d^2+b^2\,c^2\,d^4\right )}-\frac {C\,c^2-B\,c\,d+A\,d^2}{f\,\left (a\,d-b\,c\right )\,\left (c^2+d^2\right )\,\left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
sympy [F(-2)] time = 0.00, size = 0, normalized size = 0.00 \[ \text {Exception raised: NotImplementedError} \]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________